<?php
// +----------------------------------------------------------------------
// | Fengli [ WE ONLY DO WHAT IS NECESSARY ]
// +----------------------------------------------------------------------
// | Copyright (c) 2017 http://www.yanyongwang.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 风黎 < 1280246895@qq.com >
// +----------------------------------------------------------------------


namespace app\api\controller;


use \think\Controller;
use think\Request;

/**
 * 接口类基类
 * Class Base
 * @package app\admin\controller
 */
class Base extends Controller
{
    public function __construct(Request $request = null)
    {
        header("Access-Control-Allow-Origin: *");
        parent::__construct($request);
    }

    protected function returnData($code='200',$msg='请求成功',$data=[])
    {
        $returnData = [
            'code'  => $code,
            'msg'   => $msg,
            'data'  => $data
        ];
        return json($returnData);
    }
}